<%@page language="java" pageEncoding="utf-8" %>
<%@page import="cn.com.wxd.common.DateUtil" %>
<%@page import="cn.com.wxd.util.service.ProjectInfo" %>
<%
    String path = request.getContextPath();
    String basePath =
            request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";

%>

<!DOCTYPE html>
<head>
    <base href="<%=basePath %>">
    <title><%=ProjectInfo.getCompanyName() %>登陆</title>
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="description" content="This login page">

    <link rel="shortcut icon" href="favicon.ico"/>
    <link rel="stylesheet" type="text/css" href="static/admin/lib/bootstrap/css/bootstrap.css">

    <link rel="stylesheet" type="text/css" href="static/admin/css/theme.css">
    <link rel="stylesheet" href="static/admin/lib/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="static/util/css/loaders.min.css"/>
    <style type="text/css">
        #line-chart {
            height: 300px;
            width: 800px;
            margin: 0px auto;
            margin-top: 1em;
        }

        .brand {
            font-family: georgia, serif;
        }

        .brand .first {
            color: #ccc;
            font-style: italic;
        }

        .brand .second {
            color: #fff;
            font-weight: bold;
        }

        /**
		*这些样式用于调整动态图标的位置和样式
		**/
        #loader > div {
            background-color: #494949;
        }

        #loader {
            margin-left: 150px;
        }
    </style>
</head>

<body>
<div class="navbar">
    <div class="navbar-inner">
        <ul class="nav pull-right">

        </ul>
        <a class="brand" href="#"><span class="first"><%=ProjectInfo.getCompanyName() %></span> <span class="second">后台管理系统</span></a>
    </div>
</div>
<div class="row-fluid">
    <div class="dialog">
        <div class="block" style="">
            <p class="block-heading">登 陆</p>
            <div class="block-body">
                <form id="loginForm" action="admin/login" method="post" onsubmit=" return formsubmit()">
                    <label>用户名&nbsp;&nbsp;</label>
                    <input class="span12" type="text" maxlength="24" name="userName" required="required"
                           id="userName" value="${requestScope.userName}"/>
                    <label>密&nbsp;码&nbsp;&nbsp;</label>
                    <input type="password" name="passWord" required="required" maxlength="16" id="passWord"
                           autocomplete="off" class="span12"/>
                    <label>验证码&nbsp;&nbsp;</label>
                    <input type="text" required="required" name="verCode" maxlength="4" id="verCode" class="span12"/>
                    <img id="vercodeimg" alt="点击切换图片" title="点击切换图片" style="width:85px;height:25px" border="0"
                         src="vercode/vercodeQQ?time=<%=DateUtil.getTimestamp()%>"/>
                    <span id="submitA"><input type="submit" class="btn btn-primary pull-right" value="登&nbsp;陆"/></span>
                    <div class="clearfix" id="errorMessage" style="color:red">
                        <p>${requestScope.actionError}</p>
                    </div>
                </form>
            </div>
        </div>
        <p class="pull-right" style=""><a href="admin/applyfor">没有账号请点击注册！</a></p>
    </div>
</div>
</body>
<script type="text/javascript" about="">
    if(window.top!=window.self){//存在父页面
        parent.location.reload();
    }
</script>
<script type="text/javascript" src="static/js/jquery1-11-3.min.js"></script>
<script type="text/javascript" src="static/js/base64.min.js"></script>
<script type="text/javascript">
    $(function () {
        $("#vercodeimg").click(function () {
                $("#vercodeimg").attr("src", "vercode/vercodeQQ?time=" + new Date());
                $("#errorMessage").html("");
            }
        );
    });
    function formsubmit() {
        var userName = $("#userName").val();
        var passWord = $("#passWord").val();
        var vercode = $("#verCode").val();
        var message = "";
        var issub = true;
        if (userName == "") {
            message = "用户名不能为空!<br/>";
            issub = false;
        }
        if (userName.length < 6) {
            message = "用户名长度不能小于6!<br/>";
            issub = false;
        }
        if (passWord == "") {
            message = message + "密码不能为空!<br/>";
            issub = false;
        }
        if (passWord.length < 6) {
            message = message + "密码长度不能小于6!<br/>";
            issub = false;
        }
        if (vercode == "") {
            message = message + "验证码不能为空<br/>";
            issub = false;
        }
        if (vercode.length < 4) {
            message = message + "验证码不正确<br/>";
            issub = false;
        }
        if (issub == false) {
            setTimeout(function () {
                $("#errorMessage").html("");
            }, 3000);
            $("#errorMessage").html(message);
        } else {
            $("#submitA").html("<div id=\"loader\" class=\"loader-inner ball-pulse\"><div></div><div></div><div></div></div>");
            issub = true;

        }
        try {
            $("#passWord").val(encode64(passWord));  //进行加密
        } catch (e) {
            issub = false;
        }
        return issub;
    }

</script>
</html>







